package com.example.demo517.mapper;

import com.example.demo517.entity.Studentinfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.*;
import com.example.demo517.vo.viewStudentinfo;

import java.util.List;

@Mapper
public interface Student_Info_mapper {
    @Select("select * from student_info")
    public List<Studentinfo> getStudentInfo();
    @Select("select * from student_info where stuid= #{id}")
    public Studentinfo getStudentInfoByStuid(Integer id);
    @Delete("delete  FROM  student_info where stuid= #{id}")
    public int  deleteStudentInfoByStuid(Integer id);
    @Insert("INSERT INTO `student_info` (stu_no, stu_image_url, stu_name) VALUES (#{stu_no}, #{stu_image_url}, #{stu_name});")
    public int insertStudentInfo(Studentinfo studentinfo);
    @Update("UPDATE student_info " +
            "SET stu_no = #{stu_no}, " +
            "    stu_image_url = #{stu_image_url}, " +
            "    stu_name = #{stu_name}, " +
            "    stu_sex = #{stu_sex}, " +
            "    password = #{password}, " +
            "    stu_phone = #{stu_phone}, " +
            "    sal = #{sal}, " +
            "    stu_address = #{stu_address}, " +
            "    stu_birthday = #{stu_birthday}, " +
            "    stu_email = #{stu_email}, " +
            "    stu_education = #{stu_education}, " +
            "    stu_interest = #{stu_interest}, " +
            "    my_color = #{my_color}, " +
            "    lucky_number = #{lucky_number}, " +
            "    re_mark = #{re_mark}, " +
            "    clsid = #{clsid} " +
            "WHERE stuid = #{stuid}")
    public Integer updateStudentInfo(Studentinfo studentinfo);
    @Select ("select stu.*,c.className from student_info stu\n" +
            " join classinfo c\n" +
            " on stu.clsid=c.clsid")
    public List<viewStudentinfo> findStudentInfo_clsname(Integer pageNum,Integer pageSize);
}
